import type { AxiosRequestConfig } from 'axios'
import type { ApiResult } from '@/types/app'
import type { RequestOptions } from '@/utils/http'
import { http } from '@/utils/http'
/**  数据供给情况、添加水印供给情况、脱敏供给情况 */
export function getHomeSituation(config?: AxiosRequestConfig<any>, options?: RequestOptions) {
  return http.get<ApiResult<any>>({ url: '/dms-mask-center/api/v1/overview/home/supply/situation', ...config }, options)
}

/** 敏感数据类型分布 */
export function getHomeDataTypeStatistic(config?: AxiosRequestConfig<any>, options?: RequestOptions) {
  return http.get<ApiResult<any>>({ url: '/data-center/api/v1/data-center/home/dataType/statistic', ...config }, options)
}
/**顶部数据表(table_count)、字段数(field_count)、文件数(file_count) */
export function getHomeChangeDetail(config?: AxiosRequestConfig<any>, options?: RequestOptions) {
  return http.get<ApiResult<any>>({ url: '/data-center/api/v1/statistic/data/upper/changeDetail', ...config }, options)
}
/**顶部数据库数量 */
export function getHomesql(config?: AxiosRequestConfig<any>, options?: RequestOptions) {
	
	const currentDate = new Date();
	const optionsa = {
	  year: 'numeric', // 4位年（如 2025）
	  month: '2-digit', // 2位月（如 10）
	  day: '2-digit' // 2位日（如 30）
	};
	const formattedDate = currentDate.toLocaleDateString('zh-CN', optionsa).replace(/\//g, '-');
	
  return http.get<ApiResult<any>>({ url: '/resource-management/api/v1/resource/access/statistic/type/change/'+formattedDate+'?actual=true', ...config }, options)
}

/**顶部API数(totalAsset) */
export function getHomeApiCount(config?: AxiosRequestConfig<any>, options?: RequestOptions) {
  return http.get<ApiResult<any>>({ url: '/risk/api/v1/assetdetail/statistics', ...config }, options)
}

/** 顶部涉敏数据表(sensitiveTableCount)、涉敏字段数(sensitiveFieldCount)、涉敏文件数(sensitiveFileCount) */
export function getHomeSensitiveStatistic(config?: AxiosRequestConfig<any>, options?: RequestOptions) {
  return http.get<ApiResult<any>>({ url: '/data-center/api/v1/data-center/home/dataAll/statistic', ...config }, options)
}

/**
 * 等级统计
 */
export function getHomeRiskLevelTrendLast5Days(config?: AxiosRequestConfig<any>, options?: RequestOptions) {
  return http.get<ApiResult<any>>({ url: '/risk/api/v1/metric/statistics/riskLevelTrendLast5Days', ...config }, options)
}

/** 类型统计 */
export function getHomeListTop5EventType(config?: AxiosRequestConfig<any>, options?: RequestOptions) {
  return http.get<ApiResult<any>>({ url: '/risk/api/v1/metric/statistics/listTop5EventType', ...config }, options)
}

/**处理统计 */
export function getHomeStatisticsEventDealStatus(config?: AxiosRequestConfig<any>, options?: RequestOptions) {
  return http.get<ApiResult<any>>({ url: '/risk/api/v1/metric/statistics/statisticsEventDealStatus', ...config }, options)
}
